import {AxiosPromise, Option} from "@/types/common";
import {get, post, put} from "@/utils/request";

export const useTemplateGroupApi = (id: number) => {
    return get('/generator/v1/templateGroup/' + id)
}

export const useTemplateGroupSubmitApi = (dataForm: any) => {
    if (dataForm.id) {
        return put('/generator/v1/templateGroup', dataForm)
    } else {
        return post('/generator/v1/templateGroup', dataForm)
    }
}

/**
 * 模板组选项列表
 */
export const useTemplateGroupOptionsApi = (): AxiosPromise<Option[]> => {
    return get('/generator/v1/templateGroup/options')
}
